package groupon.contents.bo.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import groupon.contents.bo.service.ContentTypeService;
import groupon.contents.dao.ContentTypeDao;
import groupon.contents.model.ContentType;

@Service(value ="contentTypeService")
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class ContentTypeServiceImpl implements ContentTypeService {

	@Resource(name = "contentTypeDao")
	private ContentTypeDao contentTypeDao;
	
	public List<ContentType> getAll() {
		return contentTypeDao.getAll();
	}

	@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
	public void save(ContentType contentType) {
		contentTypeDao.save(contentType);
	}

	public ContentType findContentTypeByName(String name) {
		return contentTypeDao.findContentTypeByName(name);
	}

	@Transactional
	public boolean delete(Integer id) {
		return contentTypeDao.delete(id);
	}

	public ContentType findContentType(Integer id) {
		return contentTypeDao.findContentType(id);
	}
	
	@Transactional
	public ContentType update(ContentType contentType){
		return contentTypeDao.update(contentType);
	}

}
